Okay, so in the last lesson we started off making the obstacle course here.
We did two of the stages as well as the spawn.
And in today's lesson, I'm hoping to finish off making the last three stages to this.
Okay, so again up to you what you want to do with these lessons.
If you want to use this as an inspiration, if you want to follow along, or if you just want to use
this when you get stuck completely up to you.
Okay.
So let's go back over to this bit over here.
And let's just organize this around.
So.
Stage two.
Here.
We've got the lava parts.
We've got our scripting.
That's fine.
The spawn location, the stage part, the start.
And we just need a spawn location under stage three as well there.
So let's copy over the spawn location and the base plate copy.
Duplicate those.
Put them into stage three where we can just move it across here as well.
Don't want too too much difficult of a jump there.
If that's possible then that will be completely fine.
Remember we need to duplicate the end part paste.
Move this over to stage two and put this inside here as well.
Um, if you don't, if you're not, if you're not, follow along with the start and end parts just yet.
That is okay because that will be coded in a later lesson, but I think it's still a good idea to have
them already.
Oh, this needs to be not there, but there.
Okay, cool.
So we've got the first two working.
Let's keep going.
So stage.
We need the stage part showing the that we want to stage three next.
Um uh, it does this sometimes.
Um, I'm not too sure why, but for some reason, sometimes it you're not.
It doesn't let you drag it anymore, which is quite annoying.
It does slow things down a little bit.
So if that does happen, you can always select the parent property, click that and put it into stage
three.
There.
Slows things down a bit unfortunately.
But um, it's not too much.
I don't think you can do about that one.
Okay, cool.
And we've got our end part here.
So we want to copy a start part over and put this into stage three and move this over to the start here
as well.
Perfect.
Okay.
So stage three I'm wanting to do a bit more coding as well for stage three.
My idea was to create some parts which move you have to jump on moving parts and they will take you
to the end.
However, it's not going to be that easy because there's going to be obstacles you can have to jump
over while you're on the moving part.
So you have to make sure the character is staying on the moving parts and also jumping over any obstacles
that are that existing.
So a bit more difficult and a bit more interesting, I think.
Obviously this isn't stage two, it's this stage.
This is stage three.
So we can change the text label to stay to say here stage three.
Oh I don't like that because it's um, I like I like the other two where it's flat out like that.
So let's try and change that.
Um, the text scaled is on.
That's the issue.
Increase the size of this, perhaps a tiny bit.
Um, this is along the Z.
So maybe saying eight.
There we go.
That would work fine.
Just like that.
They're slightly bigger than the other two, but no one's going to notice, so it's completely fine.
Okay.
Um, cool.
So stage three, I'm going to copy the base plate and move this over.
This is this is going to be much smaller, maybe about five I think probably yeah I like this to be
a circular part.
So let's change this to be a cylinder.
And we need to rotate and do some things.
So it's a circle obviously it's tall.
We need it to be wide.
So let's change this to five.
Change this 1 to 1.
There we go.
And I'm also going to change this to a wood colour as well.
So let's give it like a brown kind of colour and change the material to be wood.
Looks quite nice there.
Okay.
So let's position it into place.
Let's put it this is the middle here.
So let's change the move here to be maybe be about five.
Cool.
And let's just call this platform moving platform I should say.
Okay.
And I want them to be.
I want them to be two of them.
So one's going to start here.
It's going to go up here as you mean second one which you can jump over to, which will be here and
will take you to the end.
So we need to put that into place as well.
Okay.
I mean definitely we can definitely make that jump.
So that's fine.
Okay.
So we want to think how far we want needs to move up basically.
So let's I'm going to duplicate this for now.
So let's say move it by ten.
So this is one this is ten.
Sorry that was not enough say 2030 might be nice I think moving it by 30.
I think so.
So that would be where that ends up at.
So this one will kind of continue on from there and move another ten, 20, 30 to the finish there.
Just so we know where it should start, where it should finish and so on.
Now last time we made one script, all of a different parts.
However here we're not going to be able to do that because, um, they will be moving um, at two different
positions.
And while you could, there'd be too many values and stuff to add in to make it worth it.
Okay.
So we're just going to code them individually.
So let's add a script into moving platform.
And we need to get it from here to here.
Now we can't just say platform dot position is equal to the position of this one because then it just
jumps there.
That's no good.
We want it to very slowly move across until it reaches this position here, which we can do a number
of different ways.
But I think the best way to do it would be to use some for loops.
Okay.
So by slowly individually moving it small units until it reaches the end.
So let's go into here, let's reference a part.
So local part is equal to script dot.
See by adding these scripts into the actual parts themselves are much easier to reference.
And we want to add in the start position and the end position.
So the start position is going to be here.
So let's copy this position like that here.
See how I change it at the start.
It makes it easier because if it had position something like -2 to 6.579.
And then I try and work that out, it's a lot more difficult.
So it always makes your life easier if everything's um, doesn't include decimals if it doesn't have
to.
Dot position is equal to vector three.
Remember because this is a position and we can just paste that in there.
And an end position is equal to vector three dot new.
This will be the position of this object here.
And once we've got that we can just completely delete that part because we don't want it.
We only point of it was just to see where it ended up.
Okay.
So from here we want to well create two for loops.
One for loop is going to slowly move it from the start to the end.
And of course it needs to go back.
So the other for loops in move it from the end to the start.
These four loops need to work after each other, so the first one runs and the second one then go back
to the first one.
And the way to do that would probably be using a repeat loop.
So it repeats working the two for loops.
So let's write a repeat.
Now in this case we don't want this to repeat to end at any point.
So to do that we say repeat until false to make sure that it keeps repeating forever okay.
And let's write in our two if for loops or if loop.
Sorry for loops here okay.
So we need to kind of work out how many times we want it to run this and how much we want to move it
by each time.
Now we know there's a difference of 30 starts, which I'll just write there.
So I would say a good amount to move it would be 300 okay.
This means it's small enough so you can't really notice it, but um, big enough that it's looks quite
nice as well.
Um, so I'm going to say here for I is equal to one comma 300 comma one.
Do like this here.
Okay.
And each time all we're going to do is we're going to say that the parts position is equal to.
Well we want to take the start position and add some amount onto it.
But if we look at the end position they're negative which means it's the other way around.
Negatives.
The larger a negative number becomes, the smaller it is, because the further it is away from zero.
So we're wanting to actually take away a value here.
So the parts position, the parts position is equal to the current position minus um a certain amount.
Now we need to minus the vector three value okay.
Because we're looking at positions here and we're only interested in the x coordinates because that's
the only one that changes the y.
And the z stay the same.
So something.
Um, comma zero.
Comma five.
They will stay the same.
Okay.
This something bits here.
However, we obviously need to put something in.
Um, so let's think about it.
If this runs 300 times and we want to eventually move it 30 studs.
Okay, the maximum value of I will be 300.
So we want the maximum value it to move to be 30.
300 divided by ten is 30.
And that's how we do it using a little bit of maths.
Okay.
So we take the the value of I and divide it by ten okay.
Which means that once it gets to the end, once the end value of 300 arises divide it by ten okay.
Which means it's 30, which means it has moved it the amount required.
Okay.
So if you're a bit confused how much to move it for yourself, you have to see how many studs, um,
is the difference between the two and then what to set the value of the end end value of I, and also
how much to move it by each time?
Okay.
Um, now I've done some practicing on this before I found out that a weight value of 0.02 is quite good,
so this is the amount that it weights, um, between each movement, because of course you can't just
set it like that because it will move it all basically immediately.
Okay.
But if you want to we can just test it out just to see how it might work there.
Oh.
Okay.
What happened there?
Ah, sorry.
Um, I need to put a weight 0.02 here as well, because, of course, we haven't done it going back
yet.
Um, let's try that again.
Okay.
This is really not working, right?
Okay, let's let's just do the other bit first and see what see what the issue with that is.
Um, okay.
So obviously after that's done, we wait an amount of seconds, then we can just repeat it.
But going the other way around.
Okay.
So um, we would instead of taking away the value, we'd add the value, but this wouldn't be, um,
to this.
Ah, I see what I've done here.
It's not the current position.
It's the start position.
There we go.
Okay, so so we're taking it from the start position here, and we're taking away a certain amount until
the end.
When when we're taking away a whole, a whole 30 starts.
So at this point we're taking the end position and we're adding that amount there.
That's why it started to speed up really weirdly.
Um, okay, let's try this again now.
And um.
Okay.
Right.
Have I messed up one of the positions?
Mhm.
I might ask.
Sorry.
Um.
I'm not adding five.
I'm adding nothing.
Because even though it's five up here, we don't want to add or take away any value, otherwise it will
move different axes.
There we go.
That looks better now.
It's fast enough that if you.
If you miss it, it's okay, but it's not.
Um.
Yeah.
Sorry.
It's slow enough.
So if you miss it, it's okay.
But it's not too fast.
It's difficult for the player.
You can see it stops there very briefly.
Goes back.
And there you go.
Cool.
So we can do a similar kind of thing.
Okay.
So let's.
Yeah.
So similar kind of thing for the other part.
So let's copy this script and put it into this one here.
Okay.
So the second one down because remember this one here.
Other one.
Not this one.
That moving platform, because this one here is just so we can see where it should end up.
Okay.
Now the reason why we're using this one is because if we use this one that's going to move over here
and it's going to move over here, and we're never going to be able to jump from it.
So they both have to meet in the middle so a player can jump over to the next one.
Okay.
So this one here let's go into the script for this.
Now the start position is instead going to be this here which we can just copy over.
And then the end position is going to be this one here, which again we will just copy over.
Cool.
Um, we will, I believe, have to change this around a little bit.
So we'll be adding here and we'll be taking away here because we're going in the opposite direction.
And that should be all the changes we need to make.
So let's delete this part and just try it out and see how this works.
So it they start off like this.
Um, they go in hopefully meet in the middle and come back out.
We'll see what happens.
So they meet in the middle there.
Perfect.
And then they go back out just like that.
They're cool and hopefully it will just keep repeating forever.
Nice.
Okay.
Nice and easy.
Only other thing we want to add on here are some obstacles.
Okay.
So let's copy one of these parts.
Delete the script in it.
Of course.
Call this just part.
That's fine.
Change the shape to block.
I'm going to add some leaves in the way we kind of look like trees, so adding some leaves in the way
might be a cool addition.
The synaptic grid is too much.
So let's increase that a little bit.
Cool.
And they need to be able to jump over these obstacles here.
Okay, let's change these to be like a sea green.
The material to be leafy grass.
Oh.
Here we go.
Looks quite nice there.
Okay, so we've got one here and we've got another one a bit further on, like about there before they
meet in the middle.
And then we can do the same kind of thing for the other direction as well.
Let's move these to be B5.
Let's move one here and one here as well.
The player is able to kind of jump on these, I guess, but they also have to wait for this part here.
So I guess there's a couple of options on how you how you go around this one.
Um, but yeah.
So let's play it or play play the game here and see how it's worked.
Now, most likely I'm gonna have to wait if in case I'm quick.
Oh, just about all the parts gone.
They are all anchored.
Hmm.
That's really strange.
Is it because of Archivable?
Believe it because of this one here that was turned off.
There we go.
Having that issue.
That's why.
Okay, I'm going to spawn right here and very quickly get onto that object.
Otherwise I'm going to wait a little while.
Whoop, whoop.
There you go.
Not easy.
Definitely more difficult than the other two stages.
Then we jump over to here.
Jump on here.
Oh, I fell off.
But we know it all works fine.
We're just great.
Okay.
Quite a cool stage.
Okay, so now I've done that one.
We can copy over the base player and spawn location and also the stage part, to be honest.
On to the next stage, which is stage four here.
And let's just move those over into a nice position for the player to get onto.
Nice.
Um, stage here has a start part, but not an end part.
So let's go over to stage two.
Copy over the end part.
Put that into stage three and move that around.
Same kind of things we've done last lesson so that we know when the player is finished.
Cool.
And then on stage four we obviously need a start part.
So let's copy this over to stage four here and move this over so we know when the player is going to
start.
Okay.
And obviously we can change this here to stay, to stay, to say stage for.
Oh, I all my caps lock again.
Cool.
So it's coming along now.
Got another cool stage to do now for this one.
I want some expanding parts.
So these parts expand so that the jump is too large for the player to make when they're small.
But the player can reach it when when the parts are large.
Okay.
That's about it.
Going to have a look at.
Now I'm going to use something very similar to this actually.
So I'm going to actually copy that and paste it into stage for us to use.
This time though, I'm going to set the color to be like a blue kind of color and maybe change the material
to be something else cool.
Maybe I'm looking at diamond plates.
It looks quite cool.
We can use that.
Okay.
So we've got one here.
And these aren't these are called expanding platforms.
We need change the name of these.
Delete the script, cause obviously it's a completely different script.
We're going on to code here.
One here.
One here and one here as well.
Okay.
We'll have to see if it's if, um, if the, if the size between them is enough.
But we can have a look in a minute.
Maybe a little bit larger, I think just by looking at it to start off with.
But again, we'll see in a minute.
Okay.
So the parts here again I would probably recommend just putting these.
Um.
Mm.
We could create a folder and do it using a four comma V again.
But because there's only three, I don't think I'm going to bother personally.
You can if you'd like to.
I think it's more important if you've got a lot more objects.
Um, so let's add a script into here.
Okay.
And this is going to be called just expanding part or expanding part.
Cool.
Okay.
Reference the part.
So local part is equal to script dot parent.
And I'm going to do a very similar thing to the last script over here.
But this time we're going to be increasing the size okay.
So repeat loop repeat until false.
And in here we're going to put in two for loops one making it larger, one making it smaller.
So we're going to set this 1 to 150 times.
And I'm going to say part size is equal to a vector pre value.
And we're going to save the size always.
The x value is always one because that's the this this this bit here.
So we want that size to always change.
But the other axes to move at the same rate.
Now we want the current amount plus an additional bit.
So it's currently five.
So we want to provide five plus some amount.
And if we say I divided by ten that's quite a good amount because 50 divided by ten is five.
So the maximum amount will be ten.
So it doubles basically.
And with some experimenting I think that's the best one to do.
But again, feel free to change this around and edit the script.
That's completely fine.
I'm going to wait slightly less time at 0.01 seconds for now.
Okay, wait another one seconds.
Repeat this again for it getting smaller, but this time we're going to do, um, not five but ten because
remember, now it's gone up to ten.
So we're doing ten minus instead of five plus.
And yeah.
So we're just kind of very similar to the other one.
Um, let's just run this and make sure it's okay.
So not play here.
Run I need to redo that.
Just to make sure it's okay.
Here we go.
I like that quite a lot, especially how it moves as well.
Think that's quite cool.
Cool.
And we can always obviously reuse this for the other ones as well.
There.
And there.
Let's try this out again.
Nice.
So obviously we need to try out and make sure that we can jump over these parts correctly.
So let's just play the game here.
We can all be scripts.
Um.
They're called scripts.
They're not anything to do with our scripts here.
You probably won't get them on your side.
You gotta jump here.
Goes out.
Jump across just about.
Jump across or just about.
Let me jump on to the next bit and then that'll be it there.
I want to make use of the truss parts, which are the ladder parts.
So let's add one of these in.
So go over to this setup truss and add it in like that.
The reason why I didn't just duplicate it and change the shape um, the um, the shape property is because
it doesn't exist on the shape property you have.
It's actually its own part you have to add in manually.
Okay.
And this one here, because it is I just want to make sure it's all lined up properly.
Um, going over to here and it is which is fine now lined up quite nicely.
Um, and let's move it across.
And as we increase the size or increase the scale on this one by a size across here you can see it increases
in size there.
I believe this needs to be done by 15.
Is the size of this here we can just check.
Oh no it's 20.
So we can change this to 20.
Here again just having everything lines up and everything looks quite nice.
And we can just well you can't increase the length of it down here.
So instead I'm just going to duplicate this a couple times.
To.
Great.
For.
Five.
Nice.
And I think because, um, we could probably.
Move it back a bit as a plague and drop down a bit.
I didn't go into these ones making group these as a model and just call these ladders or ladder.
Okay.
Um, and then of course it will feed onto the last stage.
So let's again copy um, this stuff here.
So copy the base plate, um, spawn location and the stage parts duplicate put into um stage five up
here.
It is reusing all our assets we've already got, instead of having to make a new one each time.
And obviously we need to do the start and end parts.
We can close off some of these actually.
Make it easier to work with.
Um, and then we can say this one has got a start, hasn't got an end.
So we need to go over to stage three.
Copy the end over.
Put it into stage four.
Move it across so it lines up nicely.
There we go.
There.
And then obviously we need to copy over the start bits and put this into stage five as well.
So we know when we've started the last stage.
And if you're a bit confused with all these parts, again we are going to code them in a little bit
okay.
In another lesson.
Cool with the stage part change, obviously, to stage five and we're on to the last stage now.
This last stage is going to be a nice, simple stage.
You might have seen this with a lot of hobbies and stuff before.
Basically there's free routes to go and only only one of them is the correct route.
If you go in any of your other routes, other routes, you'll kind of drop down, which is what we're
going to have a look at making now.
Okay, so let's get the base plate here.
Let's copy it and work off of this here.
And we can we can control whether the weather player is going to fall down or not by the can collide
property.
The player can't collide with the object.
It will just fall through it.
Across here.
And let's move it down.
See how five looks.
The middle.
And in the end River.
Think we need to move it by 0.5, I think here.
That looks even.
Yeah, I think that looks nice.
I think I'll stick with that.
So let's re change the appearance on all of these changes.
New plastic I think.
And let's give it some nice colors I'm going to choose maybe yellow and blue for example.
New yellow and really blue.
But again, of course you can change whatever you want.
You ever want it to be.
Okay.
And, um, let's go and copy one of these.
Let's change this back to one.
We don't need that.
Over to here.
So there's a bit of a jump on to the next stage and a platform here.
So if.
Um, it's say the next one.
So if say if this is the first one, this is the first correct one.
And.
My next correct one is over here.
You can jump to it or.
Okay.
Um so over to here changes to be black.
Will be black, and then we can just copy this 1 or 2 more times as well.
Looks nice and maybe one more time.
Until we get rid of this bit here at the end.
That will just feed on to the finish.
Okay.
Now, one of these we need to pick to be the correct one.
So I think this one here to pick the middle to start off with.
So I'm going to select the kankali off here and off here.
This one I'm thinking to pick for this one here.
So that's going to be off.
This one's going to be off I think also selecting this one to be the end here as well.
So off and off because people make playing these games like to like to do it in a systematic way and
kind of say let's try this one first and this one first.
So we're going to make it difficult for them.
Um, cool.
So um, let's just again copy stuff over now okay.
So we're going to copy over the spawn location in the base plates.
Not the stage part though, because again, this is the finish.
We don't need to need to um, copy that.
Over.
Put these into the finish as obviously the finish still needs a spawn location.
Okay.
And put that.
Just about there.
And of course, stage five needs an end part, which we can get from stage four.
Copy put into stage five and move over to.
There and, um.
Yeah, there you go.
That's the Obby creators.
Hopefully it wasn't a too repetitive, um, moving things over each time.
Okay.
Of course.
Don't feel limited to only including five stages.
You can get as many stages as you like to in your obby.
Only thing is, when you are coding it, you will need to keep into into mind that there's five.
There's more than five stages too.
So just edit some of my code around.
Um, but yeah.
So experiment with those.
Try out some new stages, but let's see some examples of what you can do.
Or maybe play some games for inspiration.
It's completely up to you.
Um, but there you go.
So now we've completed, um, designing the five stages, and we've also coded individual stages itself.
Next lesson we're going to have a look at the finish area.
Okay.
So the finish area might have some cool stuff to do.
Okay.
And I'm not sure yet either in that lesson or in another lesson, we're going to have a look at the
coding system for the obby that will be the coding, the spawn locations and also coding the timer as
well.
So hopefully again you've enjoyed this one and you can see me in the next lesson.
We're going to have a look at the winners section.